<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<style>
    table {
        width: 300px;
        table-layout: fixed;
        /*border-collapse: collapse;*/
    }

    tbody {
        display: table-row-group;
        vertical-align: middle;
        border-color: inherit;
    }

    tr {
        display: table-row;
        vertical-align: inherit;
        border-color: inherit;
    }

    td {
        border: 5px solid;
        border-color: #dc143c #1e90ff orange #32cd32;
        padding: 5px;
    }
</style>
<body>
<div id="app">
    <table id="example-element" :style="id===0?'borderCollapse:collapse':'borderCollapse:separate'" >
        <tbody>
        <tr>
            <td>Cell 1.1</td>
            <td>Cell 1.2</td>
        </tr>
        <tr>
            <td>Cell 2.1</td>
            <td>Cell 2.2</td>
        </tr>
        <tr>
            <td>Cell 3.1</td>
            <td>Cell 3.2</td>
        </tr>
        </tbody>
    </table>
    <button @click="switchc">切换</button>
</div>
<script>
    new Vue({
        el:"#app",
        data(){
            return{
                id:0,
            }
        },
        methods:{
            switchc(){
                this.id===0?this.id=1:this.id=0
                console.log(this.id)
                return this.id
            }
        }
    })
</script>
</body>
</html>
